package helpers;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ValidateHelper {

	private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
	private static final String PHONE_PATTERN = "((09){1}[0-9]{8}|(01){1}[0-9]{9})";

	public static boolean isEmail(String email) {
		Pattern pattern;
		Matcher matcher;
		pattern = Pattern.compile(EMAIL_PATTERN);
		matcher = pattern.matcher(email);
		return matcher.matches();
	}

	public static boolean isPhoneNumber(String phoneNumber) {
		Pattern pattern;
		Matcher matcher;
		pattern = Pattern.compile(PHONE_PATTERN);
		matcher = pattern.matcher(phoneNumber);
		return matcher.matches();
	}	
}
